// import api from '../../api/user'
const user = {
  namespaced: true, // 开启命名空间
  state: {
    img: '', // 用户头像
    id: '',
    account: '',
    nackname: '',
    email: '',
    region_id: '',
    realname: '',
    age: '',
    sex: '',
    address: '', // 与用户相关的活动
    role: ''
  },
  getters: {
    img: state => state.img,
    id: state => state.id,
    account: state => state.account,
    nackname: state => state.nackname,
    email: state => state.email,
    region_id: state => state.region_id,
    age: state => state.age,
    sex: state => state.sex,
    realname: state => state.realname,
    address: state => state.address,
    role: state => state.role
  },
  mutations: {
    SET_IMG: (state, img) => {
      state.img = img
    },
    SET_USERID: (state, id) => {
      state.id = id
    },
    SET_ACCOUNT: (state, account) => {
      state.account = account
    },
    SET_NACKNAME: (state, nackname) => {
      state.nackname = nackname
    },
    SET_EMAIL: (state, email) => {
      state.email = email
    },
    SET_AGE: (state, age) => {
      state.age = age
    },
    SET_SEX: (state, sex) => {
      state.sex = sex
    },
    SET_ADDRESS: (state, address) => {
      state.address = address
    },
    SET_ROLE: (state, role) => {
      state.role = role
    }
  },
  actions: {
    async logOut () {
      localStorage.removeItem('Token')
    }
  }
}

export default user
